package com.yijiu.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.yijiu.network.Response;
import com.yijiu.resource.Bank;

public class BankResponse extends Response {

	public List<Bank> bankList;

	@Override
	protected void jsonToObject() {
		bankList = new ArrayList<Bank>();
		try {
			JSONObject data = reposonJson.getJSONObject("result");
			JSONArray array = data.getJSONArray("bankInfos");
			int size = array.length();
			for (int i = 0; i < size; i++) {
				JSONObject object = array.getJSONObject(i);
				Bank bank = new Bank();
				bank.logoUrl = object.optString("logoUrl");
				bank.bankCode = object.optString("bankCode");
				bank.bankName = object.optString("bankName");
				bankList.add(bank);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

}